<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="https://cdn.bootcdn.net/ajax/libs/js-cookie/3.0.5/js.cookie.js"></script>
    <script>
        // https://cdn.bootcdn.net/ajax/libs/js-cookie/3.0.5/js.cookie.js


        // 创建一个 cookie，在整个网站上有效：
        Cookies.set('p', '1');


        // 创建一个 7 天后过期的 cookie，在整个网站上有效：
        Cookies.set('u', '2', { expires: 20 })

        // 获取cookie
        console.log(Cookies.get('u'));
        console.log(Cookies.get());//{u:2,a:1}


        // 删除cookie
        Cookies.remove('u')
    </script>

</body>

</html>